<template>
	<view class="page_wrapper page_bg">
		<image style="width: 100%;" src="https://www.hzif.cn/mathematics-attach/share.png/h/hforxjlspxxdybmk.jpg" mode="widthFix"></image>
		<view class="main_block">
			<view style="margin-top: 30px;">请输入激活码</view>
			<view><input class="input_code" v-model="activeCode" type="text" placeholder="激活码" /></view>
			<view class="active_btn" @tap="confirmActive()">确定激活</view>
			<view>免费领取激活码，直升黄金会员</view>
			<view>活动至6月30号</view>
			<view class="show_detail" @tap="showFetchType()">
				查看免费领取方式
			</view>
		</view>
	</view>
</template>

<script>
	import {request} from '@/utils/request.js'
	export default {
		data() {
			return {
				activeCode: ''
			}
		},
		methods: {
			
			confirmActive() {
				if(this.activeCode.length < 6) {
					uni.showModal({
						title: '激活码错误',
						showCancel: false
					})
					return false
				}
				uni.showLoading({
					title: '激活中...'
				})
				// request.put(
				// 	'/activeCodes/appType,math', {
				// 		code: this.activeCode
				// 	}
				// ).then(res => {
				// 	uni.hideLoading()
				// 	uni.showModal({
				// 		title: '激活成功',
				// 		showCancel: false,
				// 		success() {
				// 			uni.navigateBack()
				// 		}
				// 	})
				// }).catch(err => {
				// 	uni.hideLoading()
				// 	console.log(err)
				// })
			},
			showFetchType() {
				uni.navigateTo({
					url: '/pages/articleDetail/articleDetail?articleNo=717466755873365'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page_wrapper{
		background-color: orange!important;
		.main_block{
			flex: 1;
			display: flex;
			flex-direction: column;
			align-items: center;
			.input_code{
				width: 250px;
				height: 40px;
				text-align: center;
				border: 1px solid #e2e2e2;
				background-color: white;
				border-radius: 20px;
				margin-top: 30px;
			}
			.active_btn{
				width: 250px;
				height: 40px;
				margin: 15px 0px;
				background-color: cornflowerblue;
				border-radius: 20px;
				display: flex;
				justify-content: center;
				align-items: center;
			}
			.show_detail{
				color: #666666;
				margin-top: 15px;
				display: flex;
			}
		}
	}
</style>
